package pt.iul.poo.monkeys;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;

import pt.iul.poo.balloons.Balloon;
import pt.iul.poo.game.Player;
import pt.iul.poo.image.properties.GameWindowInterface;
import pt.iul.poo.shapes.SimpleShape;
import pt.iul.poo.weapon.TheCoolestWeapon;
import pt.iul.poo.weapon.Weapons;

public class TheCoolMonkey extends Monkey{
	public static final int COST = 50;
	private static final String NAME = "COOL_MONKEY__SHOOTER";
	private MonkeyTypes type = MonkeyTypes.Cool;
	private TheCoolestWeapon theCoolWeapon = new TheCoolestWeapon();
	private static final int RANGE = 5;
	

	public TheCoolMonkey(String fileName, int x, int y) throws IOException {
		super(fileName, x, y, RANGE);
		super.setWeapon(theCoolWeapon);
	}

	@Override
	public String getName() {
		return NAME;
	}

	public MonkeyTypes getType() {
		return type;
	}

	public void setType(MonkeyTypes type) {
		this.type = type;
	}
	
	@Override
	public void shoot(LinkedList<Balloon> balloonsList, Player player,
			GameWindowInterface window, Weapons weapon,
			LinkedList<SimpleShape> shapesList, ArrayList<Balloon> ballonsToRemove) {
		Iterator<Balloon> it = balloonsList.iterator();
		while (it.hasNext()) {
			Balloon balloon = it.next();
			if (range(this, balloon) <= getRange()) {
				weapon.shoot(balloon, window, this, shapesList);
				weapon.removeLife(balloon, balloonsList, player, ballonsToRemove);
			}
		}
	}

}
